﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main/Site.Master" AutoEventWireup="true"
    ViewStateMode="Disabled" CodeBehind="RegionalServer.aspx.cs" Inherits="LongSpeed.WebSite.Main.RegionalServer" %>

<%@ OutputCache Duration="420" VaryByParam="pid" NoStore="true" Location="Any"%>
<%@ Register Src="~/UserControl/ucKnowledgeNavigator.ascx" TagName="KnowledgeNavigator"
    TagPrefix="uc" %>
<%@ Register Src="~/UserControl/ucPaymentMode.ascx" TagName="PaymentMode" TagPrefix="uc" %>
<%@ Register Src="~/UserControl/ServerTree.ascx" TagName="ServerTree" TagPrefix="uc" %>
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="RegionalServerContent" ContentPlaceHolderID="PlaceHolder" runat="server">
    <div>
        <div class="floatleft">
            <uc:ServerTree ID="ucst" runat="server" />
            <uc:KnowledgeNavigator ID="KnowledgeNavigator1" runat="server" />
            <uc:PaymentMode ID="ucpm" runat="server" />
        </div>
        <div id="mainarea">
            <div class="sblock2">
                <div class="sblock2-top">
                    <div class="articeltitle" style="background-image: none; width: auto; color: Black;
                        float: none;">
                        <h5>
                            <%
                                int part = Convert.ToInt32(Request.QueryString[LongSpeed.WebSite.Behaviors.SessionString.ArticlePart]);
                                LongSpeed.WebSite.Behaviors.Article article = new LongSpeed.WebSite.Behaviors.Article();

                                var p = new LongSpeed.WebSite.Behaviors.Part();
                                p.Init(part);
                                var artivles = article.GetAllArticleByPart(part).OrderByDescending(o => o.ReleaseDate);
                                    
                            %>
                            您的位置：<a href="../home.htm" title="首页" target="_parent">首页</a><span style="margin: 0px 5px;">></span>
                            <a title="<%=(p.Name) %>" target="_parent" href="<%=(string.Format("../articlelist-{0}.html", p.ID)) %>">
                                <%=(p.Name) %></a>
                        </h5>
                    </div>
                </div>
                <div class="sblock2-bottom" id="pgs">
                    <div class="listinfo" style="min-height: 750px;">
                        <ul>
                            <%
                                foreach (var item in artivles)
                                {
                            %>
                            <li><a style="display: block; float: left;" title="<%=(item.Title) %>" target="_parent"
                                href="<%=(string.Format("new-{0}-{1}.html", item.ID, part)) %>">
                                <%=(item.Title) %></a> <span style="display: block; float: right">
                                    <%=(item.ReleaseDate.ToString("yyyy-MM-dd")) %></span>
                                <%
                                    if ((DateTime.Now - item.ReleaseDate).Days < 3)
                                    {
                                %>
                                <img src="../Images1/index/new.gif" alt="新" style="margin: -2px 0px 0px 2px" />
                                <%
                                    }                                        
                                %>
                                <div class="clear">
                                </div>
                            </li>
                            <%
                                }
                            %>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
    <table width="100%">
        <tr>
            <td colspan="2">
                <div class="list listinfo">
                    <% 
                        var memuDic = Session[LongSpeed.WebSite.Behaviors.SessionString.MemuStr] as Dictionary<int, LongSpeed.WebSite.Behaviors.Memu>;
                        int parid = Convert.ToInt32(Request.QueryString[LongSpeed.WebSite.Behaviors.SessionString.ParentMemuId]);

                        var parMemu = memuDic[parid];

                        if (string.IsNullOrEmpty(parMemu.Description))
                        {
                            Response.Write("暂无数据");
                        }
                        else
                        {
                            Response.Write(parMemu.Description);
                        }
                    %>
                </div>
            </td>
        </tr>
        <tr>
            <td style="width: 25%; height: auto;" valign="top">
                <div class="tworight">
                    <uc:Bulletin ID="ucb" runat="server" />
                    <uc:OnlineContact ID="ucoc" runat="server" />
                    <uc:KnowledgeNavigator ID="uckn" runat="server" />
                </div>
            </td>
            <td valign="top">
                <% 
                    var memus = parMemu.ChildMemu;

                    Dictionary<string, GridView> dataSource = new Dictionary<string, GridView>();

                    foreach (var m in memus)
                    {
                        LongSpeed.WebSite.Behaviors.ServerConfig sce = new LongSpeed.WebSite.Behaviors.ServerConfig();
                %>
                <div class="list">
                    <div class="listtop">
                        <div class="listtopl">
                            <h5>
                                <%=(m.Name) %>
                            </h5>
                        </div>
                        <div class="listtopr">
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="listinfo">
                        <%
                        List<LongSpeed.WebSite.Behaviors.ServerConfig> datalist;

                        string key = string.Format("RegionalServer_{0}_{1}", parid, m.ID);
                        if (Session[key] == null)
                        {
                            datalist = sce.GetServersByParent(m).ToList();
                            Session[key] = datalist;
                        }
                        else
                        {
                            datalist = Session[key] as List<LongSpeed.WebSite.Behaviors.ServerConfig>;
                        }

                        if (datalist.Count == 0)
                        {
                            Response.Write("暂无数据");
                        }
                        else
                        {
                        %>
                        <table class="datalist">
                            <tr>
                                <th>
                                    CPU
                                </th>
                                <th>
                                    内存
                                </th>
                                <th>
                                    硬盘
                                </th>
                                <th>
                                    宽带
                                </th>
                                <th>
                                    单价
                                </th>
                            </tr>
                            <%
                            foreach (var item in datalist)
                            {
                            %>
                            <tr>
                                <td>
                                    <span title="<%=(item.CPU) %>">
                                        <%=(item.CPU.Length > 20 ? item.CPU.Substring(0, 20) + "…" : item.CPU)%>
                                    </span>
                                </td>
                                <td>
                                    <span title="<%=(item.RAM) %>">
                                        <%=(item.RAM.Length > 15 ? item.RAM.Substring(0, 15) + "…" : item.RAM)%>
                                    </span>
                                </td>
                                <td>
                                    <span title="<%=(item.HD) %>">
                                        <%=(item.HD.Length > 12 ? item.HD.Substring(0, 12) + "…" : item.HD)%>
                                    </span>
                                </td>
                                <td>
                                    <span title="<%=(item.Broadband) %>">
                                        <%=(item.Broadband.Length > 10 ? item.Broadband.Substring(0, 10) + "…" : item.Broadband)%>
                                    </span>
                                </td>
                                <td>
                                    <span title="<%=(item.UnitPrice) %>">
                                        <%=(item.UnitPrice.Length > 20 ? item.UnitPrice.Substring(0, 20) + "…" : item.UnitPrice)%>
                                    </span>
                                </td>
                            </tr>
                            <%
                            }
                            %>
                        </table>
                        <%
                        }
                        %>
                    </div>
                </div>
                <%
                    }
                %>
            </td>
        </tr>
    </table>
</asp:Content>
